NOTICE: By continued use of this site you understand and agree to the binding Terms of Service and Privacy Policy.
// ==UserScript== // @name FCQ网课通助手[全网题库][全网自动答题器][智能适配答题:小众网页也可识别][刷课] // @namespace http://tampermonkey6.net // @version 1.0.15 // @description 支持【超星学习通】【智慧树】【职教云系列】【雨课堂】【考试星】【168网校】【u校园】【大学MOOC】【云班课】【优慕课】【继续教育类】【绎通云课堂】【九江系列】【柠檬文才】【亿学宝云】【优课学堂】【小鹅通】【安徽继续教育】 【上海开放大学】 【华侨大学自考网络助学平台】【良师在线】【和学在线】【人卫慕课】【国家开放大学】【山财培训网(继续教育)】【浙江省高等学校在线开放课程共享平台】【国地质大学远程与继续教育学院】【重庆大学网络教育学院】【浙江省高等教育自学考试网络助学平台】 【湖南高等学历继续教育】 【优学院】 【学起系列】【青书学堂】 【学堂在线】【英华学堂】【广开网络教学平台】等平台的测验考试,内置题库,如有疑问或无法使用加群:685523298 咨询 // @author button2 // @match *://*/* // @run-at document-start // @grant GM_xmlhttpRequest // @grant GM_addStyle // @grant GM_getValue // @grant GM_setValue // @grant GM_getResourceURL // @grant GM_addValueChangeListener // @grant GM_removeValueChangeListener // @grant GM_listValues // @grant GM_deleteValue // @grant GM_getResourceText // @resource Table https://www.forestpolice.org/ttf/2.0/table.json // @require https://lf9-cdn-tos.bytecdntp.com/cdn/expire-1-M/promise-polyfill/8.2.1/polyfill.min.js // @require https://lf3-cdn-tos.bytecdntp.com/cdn/expire-1-M/jquery/3.6.0/jquery.min.js // @connect bspapp.com // @license MIT // ==/UserScript== unsafeWindow.$_=$ if (window.location.href.indexOf("https://service.icourses.cn/") != -1) { const config = { pdf_time: 20 * 60 * 1000//30分鐘 } let ChapterList = [] function GetRessList(id) { return new Promise((resolve, reject) => { GM_xmlhttpRequest({ url: "https://service.icourses.cn/hep-company//sword/company/getRess", method: "POST", data: "sectionId=" + id, headers: { "Content-type": "application/x-www-form-urlencoded; charset=UTF-8" }, onload: function (xhr) { try { resolve(JSON.parse(xhr.responseText).model.listRes) } catch (err) { resolve([]) } } }); }) } function OpenOriginDialog(Content) { return new Promise((resolve, reject) => { unsafeWindow.require(["Play"], function (Play) { let courseId = unsafeWindow._courseId; let userId = unsafeWindow._userId; let companyCode = unsafeWindow._companyCode; const ListenMessage = (e) => { if (e.data === 'lhd_close') { unsafeWindow.removeEventListener('message', ListenMessage) document.querySelector('[id^=dialog-myModal]')?.remove() resolve() } } unsafeWindow.addEventListener('message', ListenMessage); Play.dialog({ //唯一ID id: "videoBox-link", data: { url: Content.fullResUrl, companyCode: companyCode,//三方公司id resId: Content.id, type: Content.mediaType, userId: userId, courseId: courseId, title: Content.title + '' }, //弹出框宽度 width: "auto", //弹出框高度 height: (screen.availHeight - 200) + "px", //是否开启打点功能 isTicker: true }); }) }) } async function ExecteContentMission(Contet) { return new Promise(async (resolve, reject) => { await OpenOriginDialog(Contet) //执行相关内容 resolve() }) } async function AutoExecteChaprterMission(ChapterList) { for (let index = 0; index < ChapterList.length; index++) { let CurrentChapert = ChapterList[index]//获取每个章 let ContentList = await GetRessList(CurrentChapert)//获取该章数据 for (let ContentIndex = 0; ContentIndex < ContentList.length; ContentIndex++) { let CurrentContent = ContentList[ContentIndex]//遍历内容数据列表 await ExecteContentMission(CurrentContent)//执行内容 } } } function InjectButtonToBody() { let btn = document.createElement("div"); btn.innerHTML = '<button style="position: fixed;bottom: 80vw;right: 0;z-index: 9999;height: 50px;">开始刷课</button>'; btn.onclick = function () { ChapterList = [] ChapterList = ChapterList.concat(...document.querySelectorAll(".shareResources > .panel-group > li")) let ParentChapert = document.querySelectorAll(".shareResources > .panel-group > li:not(.noContent)") ParentChapert.forEach((item) => { ChapterList = ChapterList.concat(...item.querySelectorAll(".chapter-content [data-secid]")) }); ChapterList = ChapterList.map((item) => item.getAttribute("data-id") ?? item.getAttribute("data-secid")) AutoExecteChaprterMission(ChapterList) } document.body.append(btn); } function InjectVideoPage() { unsafeWindow.savevideojs = undefined Object.defineProperty(unsafeWindow, 'videojs', { get() { let result = unsafeWindow.savevideojs; return result }, set(vdobj) { vdobj.hook('beforesetup', function (videoEl, options) { options.muted = true; options.autoplay = true; return options; }); vdobj.hook('setup', function (player) { player.on("ended", function () { }); }); unsafeWindow.savevideojs = vdobj; } }) } function InjectPdfPage() { setTimeout(() => { }, config.pdf_time) } function MainBranch() { if (location.href.indexOf('/sword/rp/play/toPlay') !== -1) { InjectVideoPage() } else if (location.href.indexOf('/icourse/lib/pdfjs/web/') !== -1) { InjectPdfPage() } else { InjectButtonToBody() } } MainBranch() } if (window.location.href.indexOf("https://hzzh.chsi.com.cn/kc/xx/") != -1) { let rate = 2;//倍速 unsafeWindow.onload = function () { //在元素都加载完成后再监听video的播放时间,再进行倍速设置 unsafeWindow.document.querySelector('video').onplay = function () { unsafeWindow.document.querySelector('video').playbackRate = rate; } let hookSetInterval = unsafeWindow.setInterval; unsafeWindow.setInterval = function (a, b) { return hookSetInterval(a, b / rate); } unsafeWindow.document.querySelector('video').volume = 0 unsafeWindow.document.querySelector('video').play() var elevideo = document.querySelector("video"); elevideo.addEventListener('ended', function () { //结束 unsafeWindow.document.querySelector('video').play() }); } } if (window.location.href.indexOf("https://training.tisco.com.cn/front/command/LessonAction") != -1) { setTimeout(() => { // Your code here... setInterval(() => { // 判断当前视频有没有刷完,刷完的话就会暂停,我们就通过左下角是否变成了暂停来进行判断 // let pauseIcon = document.querySelector('.pausecenterchhulqiaoaix').style.display; let pauseIcon = document.querySelector("div[class^='pause']").style.display; console.log(pauseIcon) // 等于none的时候左下角为暂停,没有出现的时候就为block,出现了以后我们就跳到下一节 /* 这个网站右侧列表课程表当前播放的视频类名为cur_li,我们通过这个来判断,播放完成以后就播放它的下一个视频 */ if (pauseIcon == 'none') { // 直接拿到下一个视频的跳转连接 let nextHref = document.querySelector('.cur_li').nextElementSibling.children[0].href window.location.href = nextHref; } }, 3000) }, 5000) } if (window.location.href.indexOf("https://jiangxi.zhipeizaixian.com/study/") != -1) { var facejgt = true; var dtime = a_time / 5; window.setInterval(() => { let autonext = document.querySelector(".modal_mark___2vwrm"); let autoPlay = document.querySelector(".prism-big-play-btn"); let autoverify = document.querySelector(".ant-modal-confirm-btns"); let verifyhint = document.querySelector(".ant-modal-wrap"); let Playbutton = document.querySelector("#J_prismPlayer>video"); if (autonext != null) { setTimeout(function () { document.querySelector('.next_button___YGZWZ').click(); }, 2000); notifyhint('自动跳转', '已自动跳转下一节'); } if (autoPlay.style.display == 'block') { document.querySelector('.outter').click(); if (a_mute) { Playbutton.volume = 0; } } if (verifyhint != null) { if (autoverify == null) { if (facejgt) { notifyhint('人脸识别', '出来人脸识别啦!'); facejgt = false; } } } if (autoverify != null) { setTimeout(function () { document.querySelector('.ant-btn').click(); notifyhint('弹框验证', '已经继续观看'); }, 2000); } if (dtime <= 0) { dtime = a_time / 5; facejgt = true; } dtime--; }, 5000); notifyhint("启动成功", "已成功导入"); } let alllearning; let nolearning = []; let ns_player; let dbg = true; // 判断url是在课程首页 if (/https:\/\/lms.ouchn.cn\/course\/\d+\/ng#\//m.test(document.URL)) { nsd("当前在课程首页"); // 判断全部展开按钮 let cai = $(".expand-collapse-all-button>i"); if (cai.hasClass("font-toggle-all-collapsed")) { nsd("点击全部展开"); cai.click(); } // 加载所有课程 setInterval(function () { nsd("获取所有课程"); ns_nostudy(); }, 5000); } else if (/https:\/\/lms.ouchn.cn\/course\/\d+\/learning-activity\/full-screen#\/\d+/m.test(document.URL)) { nsd("在详情页"); // 处理详情 setTimeout(function () { // 2秒监控一次 setInterval(function () { ns_player = $(".vjs-tech")[0]; if (ns_player) { nsd("页面有视频") ns_playover(); ns_start(); } else { nsd("页面没视频") ns_todown(); } }, 5000); }, 15000); } // 上一页 function ns_pageback() { history.back(-1); } // 获取所有课程 function ns_nostudy() { alllearning = $(".learning-activity"); for (let i = 0; i < alllearning.length; i++) { let str = $(".learning-activity:eq(" + i + ") div.activity-operations-container .completeness").attr("tipsy-literal"); let zf = str.match(/^<b>(\W+)<\/b>/)[1]; let type = str.match(/^<b>\W+<\/b><\/br>(\W+)/)[1]; let typeEum = -1; if (type === "完成指标:查看页面") { typeEum = 1; } else if (type.indexOf("完成指标:需累积观看") > -1) { typeEum = 2; } else if (type.indexOf("访问线上链接") > -1) { typeEum = 3; } else if (type.indexOf("完成指标:参与发帖或回帖") > -1) { typeEum = 4; } else if (type.indexOf("完成指标:观看或下载所有参考资料附件") > -1) { typeEum = 5; } if (zf !== "已完成" && typeEum != -1) { $(".learning-activity:eq(" + i + ")>div").click(); break; // nolearning.push({ // type: typeEum, // id:$(".learning-activity:eq("+i+")").attr("id").replace("learning-activity-",""), // jq:$(".learning-activity:eq("+i+")") // }) } } } function ns_back(nb) { setTimeout(function () { ns_pageback(); }, nb ? nb : 5000); } var load_layer=()=>{ return new Promise(resolve=>{ if(!unsafeWindow.layer&&!unsafeWindow.addLayer){ unsafeWindow.addLayer=true $("head").append(` <link href="//unpkg.com/layui@2.7.6/dist/css/layui.css" rel="stylesheet"> <!-- 引入 layui.js --> <script src="//unpkg.com/layui@2.7.6/dist/layui.js"> `) } var clock=setInterval(()=>{ if(unsafeWindow.layer){ resolve() clearInterval(clock) } },1000) }) } var ns_pl = false; ; (function (_this) { function opeationUi(menu) { this.fcq_xm_answer = null; this.$ = $; this.menu = menu; this.initMenu(); this.config = {} return this; } opeationUi.prototype.initData = async function () { //初始化 $("#token").val(GM_getValue("token")) } opeationUi.prototype.toLog = function (explain) { setInterval(() => { let fcq_xm_select = window.getSelection().toString(); if (fcq_xm_select) { document.getElementById("fcq_xm_search_text").value = window.getSelection().toString() } }, 400) this.initData(); return this; } opeationUi.prototype.arrowMoveMenu = function (e) { let elW = e.currentTarget.offsetWidth let elH = e.currentTarget.offsetHeight let elL = e.currentTarget.parentNode.parentNode.offsetLeft let elT = e.currentTarget.parentNode.parentNode.offsetTop let x = e.clientX let y = e.clientY let w = window.innerWidth let h = window.innerHeight let moveX = x - elL let moveY = y - elT let el = e.currentTarget document.onmousemove = function (e) { el.parentNode.parentNode.style.left = e.clientX - moveX + 'px' el.parentNode.parentNode.style.top = e.clientY - moveY + 'px' } document.onmouseup = function (e) { document.onmousemove = null document.onmouseup = null } }; opeationUi.prototype.initMenu = function () { let $ = this.$, menu = this.menu; const styleTag = ` <style scoped> .fcq_xm_container{ padding:3px; pointer-events: visible; position:relative; max-height:400px; overflow:auto; text-align:left; display: none; width: 100%; max-width: 300px; z-index: 99999; border-radius: 20px !important; } #${menu.id} p{ text-align:left; padding-left:5px; } .fcq_xm_img{ border-radius: 50%; background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAUCAYAAACNiR0NAAAACXBIWXMAAAsTAAALEwEAmpwYAAAGGmlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE1QIENvcmUgOS4xLWMwMDEgNzkuYThkNDc1MywgMjAyMy8wMy8yMy0wODo1NjozNyAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvIiB4bWxuczpkYz0iaHR0cDovL3B1cmwub3JnL2RjL2VsZW1lbnRzLzEuMS8iIHhtbG5zOnBob3Rvc2hvcD0iaHR0cDovL25zLmFkb2JlLmNvbS9waG90b3Nob3AvMS4wLyIgeG1sbnM6eG1wTU09Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9tbS8iIHhtbG5zOnN0RXZ0PSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvc1R5cGUvUmVzb3VyY2VFdmVudCMiIHhtcDpDcmVhdG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ykV8J5hHRqNlvrk4WmYMtM3GUXElYpWB3x0KJB9/0CndsEpgl0TAKw9ZcrkWxwRTiKbXC7HMQ9TNOCoXzEtq6mkO/ILU2KZimNFTFhFjXE89sNYuBTku13k/0KR0wpYzLDVjnVeR7/EqCr6dN6snY29xYCiRhpfUXaWarpDdiKQfWeOQpjkDuOSVjl/jUduftwxf8DQcnDd3XtB6ODCSzGAukoaDGnPoahSHCU3XDbzQHarCUaHgSe60K9BJKWtbrYcVT9GoFTX4kx1z8YfZf4PyMnrFZeylRrzco+LTPyLcZTzfHfrM+vhKnI1K5g7sJmMnAJs8kB+77wVz+8+q7y9K76vLEXxIRLORFA6PxVByXkXtRAweUljWr5daPsybW/ZTg8nYHTQuPn0THGLW3FTHD4b03X9Tp7+kRnwyHKHuxneU9mqvl/RquEiKx9QUPhoKb7Vm3ZZT51FL0MaT0kwD7SHY9XLYFyz3v9uvFw+TBym97ZvaAx5r45BXNzQr3ZUj0VfVRAZkozW3s4ATIte+0tqL7QQcJ7Jqgs0gYmkvf/W+FtnYfCp4dkWxRWjNt2jhxe7QyWdPB4dvs1neO0grjMhCtA8JqCOyWiak1L28hbWX0CCPo0bgPZjdJqs3C5+x72r9Ou2BUrIdbSuC71aEHrpwh3mdUQmkYiI5SugjTBAm6ayftnQdWpRSNASARiJw/5fwXxU4oNDCS+vgAAAAAElFTkSuQmCC); background-size: 30px 30px; width: 30px; height: 30px; } </style>`; $(styleTag).appendTo('head'); let $menu = $( `<div id='${menu.id}' style=" font-size:14px; z-index: 10000000; text-align:center; position:fixed; background: rgb(240, 249, 235); box-shadow: 0 5px 15px rgba(0,0,0,0.8); border-radius: 10px; left:${menu.pos.x}px; top:${menu.pos.y}px; "> <div id ="fcq_xm_zhu" style="pointer-events: visible;"> <div id="fcq_xm_set" style=" font: unset; z-index: 2147483607; color: #67c23a; padding: 5px; display: flex; line-height: 1; cursor: pointer; font-size: 25px; width: unset; justify-content: center; align-items: center; "> <div class="fcq_xm_img"></div> <div>FCQ网课助手</div> </div> </div> <div class= "fcq_xm_container" id="fcq_xm_set_2"> <div style="display: flex;"> <div style="width: 45px;"> token:</div><input id = "token" style=" width: 170px; border: none; border-radius: 5px; border: 2px solid #ccc; font-size: 10px; outline: none; transition: all 0.3s ease-in-out; "/> <a target='_blank' id="fcq_web" href='https://tcb-w644nfbyxrttaih-2cpr71dbf4b7-1304481250.tcloudbaseapp.com/#/?orgin=greasyfork' style=" font:unset; width: 70px; text-align: center; display: inline-block; background: linear-gradient(to bottom, #4eb5e5 0%,#389ed5 100%); border: none; border-radius: 5px; position: relative; border-bottom: 4px solid #2b8bc6; color: #fbfbfb; font-weight: 600; font-family: 'Open Sans', sans-serif; text-shadow: 1px 1px 1px rgba(0,0,0,.4); font-size: 10px; text-indent: 5px; box-shadow: 0px 3px 0px 0px rgba(0,0,0,.2); cursor: pointer; padding: 5px 8px 3px 2px; ">获取(官网)</a> </div> <div style="display: flex;"> <div style="width: 45px;">题目 :</div><input id = "fcq_xm_search_text" placeholder="" style="width: 170px; border: none; border-radius: 5px; border: 2px solid #ccc; font-size: 10px; outline: none; transition: all 0.3s ease-in-out; " /> <button id="fcq_xm_search" style=" font:unset; display: inline-block; background: linear-gradient(to bottom, #4eb5e5 0%,#389ed5 100%); border: none; border-radius: 5px; position: relative; border-bottom: 4px solid #2b8bc6; color: #fbfbfb; font-weight: 600; font-family: 'Open Sans', sans-serif; text-shadow: 1px 1px 1px rgba(0,0,0,.4); font-size: 10px; text-align: left; text-indent: 5px; box-shadow: 0px 3px 0px 0px rgba(0,0,0,.2); cursor: pointer; padding: 5px 8px 3px 2px; width: 80px; text-align: center; ">开始做题</button> </div> <div> 使用前请先获取登录token后填入,选中文字点击搜索即可,更多功能请前往官网查阅,<span style="color:blue">图标可拖动</span> </div> </div> <div class= "fcq_xm_container" id="fcq_xm_answer"> <p> </p> </div> </div>`); $($menu).appendTo('html'); this.fcq_xm_answer = $('#fcq_xm_answer'); $(document).on('mousedown', '#fcq_xm_set', function (e) { window.mainProcedure.arrowMoveMenu(e);//.target.parentNode.id }); var click_set=function () { $('html').find("#fcq_xm_set_2").toggle('active'); $('html').find("#fcq_xm_answer").hide("slow"); } $(document).on('click', '#fcq_xm_set', click_set); $(document).on('input', '#token', async function () { GM_setValue("token", $("#token").val()) }) $(document).on('click', '#fcq_xm_search', async function () { let fcq_xm_answer = $('html').find("#fcq_xm_answer") let text = document.getElementById("fcq_xm_search_text") fcq_xm_answer.show("slow"); fcq_xm_answer.text(""); if (text.value.length < 6&&0) { fcq_xm_answer.append("搜索题目需要6个字符以上"); return; } fcq_xm_answer.append("若长时间未返回信息,请加群685523298反馈,注:该接口极易遭受攻击,如果无法正常使用,推荐使用官网内第二个,或耐心等待修复即可<hr>"); await window.mainProcedure.search(text.value.replace(/ /g, " ")) fcq_xm_answer.text(""); fcq_xm_answer.append("搜索到" + window.mainProcedure.config.answer.rows.length + "条相关题目<hr>"); window.mainProcedure.config.answer.rows.forEach(row => { fcq_xm_answer.append("题目:" + row.subject + "<br>" + "答案:"); row.answers.forEach(answer => { fcq_xm_answer.append(answer + " "); }); fcq_xm_answer.append("<hr>"); }); }); } opeationUi.prototype.search = (text) => { return new Promise(resolve => { let obj = { "action": "search", "search": text, "token": GM_getValue("token") || "" }; $("#token").val(GM_getValue("token")) var xm_answer=$("#fcq_xm_answer") GM_xmlhttpRequest({ timeout: 10000, method: "POST", url: "https://fc-mp-1420928c-320a-4dca-a246-45b4e1ddf142.next.bspapp.com/api", data: JSON.stringify(obj), onload: function (response) { var data = JSON.parse(response.response) window.mainProcedure.config.answer = {} if (data.list) { window.mainProcedure.config.answer.rows = data.list.map(c => { return { subject: c.title, answers: c.answer } }) resolve() } else { load_layer.then(e=>{ if(data.msg){ layer.confirm(data.msg, { btn: ['确认'] }); xm_answer.html(data.msg) }else{ layer.confirm('服务器出错,可能被人恶意攻击了,请耐心等待修复或者点击确认查看官网更多版本', { btn: ['确认'] }, function(index, layero){ window.open('https://tcb-w644nfbyxrttaih-2cpr71dbf4b7-1304481250.tcloudbaseapp.com/#/?orgin=greasyfork','_blank'); }); } }) } }, onerror: function (err) { console.log('error') xm_answer.append("发生异常:" + err); }, ontimeout: function (inf) { console.log('请求超时') xm_answer.append("请求超时:" + inf); } }) }) } opeationUi.prototype.start = function (reslist) { return this.api.start_search() } _this.opeationUi = opeationUi; })(window); if (window.location == window.parent.location) { // 判断是否为ifarm window.mainProcedure = new window.opeationUi({ id: "niu", width: 80, background: '#fff', opacity: 0.8, pos: { x: 50, y: 300 } }).toLog('0'); if(!GM_getValue("fcq_xm_init")){ $('html').find("#fcq_xm_set_2").toggle('active'); $('html').find("#fcq_xm_answer").hide("slow"); GM_setValue("fcq_xm_init",true) console.log("运行") } setTimeout(()=>{ if((!GM_getValue('token')&&!unsafeWindow.load_zhushou_state)&&window.location.host!="tcb-w644nfbyxrttaih-2cpr71dbf4b7-1304481250.tcloudbaseapp.com"){ load_layer().then(e=>{ layer.confirm('FCQ网课助手提示:首次使用脚本需要填写token,点击确定前往获取', { btn: ['确认'] }, function(index, layero){ window.open('https://tcb-w644nfbyxrttaih-2cpr71dbf4b7-1304481250.tcloudbaseapp.com/#/?orgin=greasyfork','_blank'); }); }) } },2000) } function ns_todown() { if ($(".open-link-button").html() && $(".open-link-button").html().indexOf("新页签打开") > -1) { nsd("处理点击链接") $(".open-link-button>i").click(); ns_back(); } else if ($(".embeded-new-topic").html() && $(".embeded-new-topic").html().indexOf("发表帖子") > -1 && !ns_pl) { nsd("处理发表帖子") $(".embeded-new-topic>i").click(); $("#add-topic-popup > div > div.topic-form-section.main-area > form > div:nth-child(1) > div.field > input").val("好好学习").trigger('change'); setTimeout(function () { $("#add-topic-popup > div > div.popup-footer > div > button.button.button-green.medium").click(); ns_pl = true; ns_back(10000); }, 1000); } else if ($("div.attachment-column.column.large-3 a:eq(0)")[0]) { nsd("处理文件预览") $("div.attachment-column.column.large-3 a:eq(0)").click(); ns_back(); } else { nsd("处理其他") $(".___content").scrollTop(999999); $(document.getElementById("previewContentInIframe").contentWindow.document).scrollTop(999999); ns_back(); } } /** * 点击所有li */ function ns_allclick() { let ali = $(".module-list>ul>li>div"); for (let index = 0; index < ali.length; index++) { const element = ali[index]; $(element).click(); } } /** * 播放方法 */ function ns_play() { ns_player.playbackRate = 16; ns_player.muted = true; $("div.mvp-replay-player-all-controls > div.mvp-controls-left-area > button > i").click(); } /** * 判断是否暂停,如果暂停,就调用播放方法 */ function ns_start() { if (ns_player.paused && ns_player.duration !== ns_player.currentTime) { ns_play(); } } /** * 如果播放完毕,调用播放下一个视频的方法 */ function ns_playover() { if (ns_player.duration === ns_player.currentTime) { ns_back(); } } /** * 播放下一个视频,如果有弹窗,那就播放当前视频 */ function ns_playnext() { let actlist = $(".activity-list>li"); let flag = false; for (let i = 0; i < actlist.length; i++) { if (flag) { if ($($(".activity-list>li")[i]).parent().parent().find("> div > div > span").text() != "视频学习") { continue; } $(".activity-list>li:eq(" + i + ")>div").click(); let popup = $(".prerequisites-confirmation-popup"); for (let j = 0; j < popup.length; j++) { if (popup[j].style.display === "block") { $(".prerequisites-confirmation-popup:eq(" + j + ") .form-buttons>button").click(); ns_play(); break; } } break; } if ($(actlist[i]).hasClass("active")) { flag = true; } } } function nsd(str) { if (dbg) { console.log(str); } } var startTime = 5000; //刷课间隔时间 //若超过该时间页面还未加载则自动跳过 var IntervalTime = 2000;//监测时长 var Video_muted = true; //开启静音 var Video_speed = 4; //倍速设置 最大16 (function () { 'use strict'; const urls = { 'course': 'https://www.zjooc.cn/ucenter/student/course/study/[A-Za-z0-9]+/plan/detail/[A-Za-z0-9]+' }; var ListStudy_main = []; var ListStudy_view = []; var ListStudy_main_now; var ListStudy_view_now; var Interval; var LN = 0; var MN = 0; var url = unsafeWindow.location.href; var href = new RegExp(urls.course); CONSOLE(); LOG(href.test(url)); if (href.test(url)) { unsafeWindow.setTimeout(function () { LOG("=========== 开始执行脚本 ========="); for (var i = 0; i < document.querySelectorAll('.el-submenu__title').length; i++) { if (i > 0) document.querySelectorAll('.el-submenu__title')[i].click() } GET_MAIN_LIST(); LOG("------------"); GET_VIEW_LIST(); LOG("------------"); //LOG(ListStudy_main); //LOG(ListStudy_view); if (ListStudy_main == "") { LOG("全部完成"); } else { ListStudy_main_now.click(); if (ListStudy_view == "") { LOG("当前小节已完成"); NEXT_MAIN(); } else { ListStudy_view_now.click(); unsafeWindow.setTimeout(AUTO_COURSE, startTime); } } }, startTime); } function AUTO_COURSE() { if (Interval) { unsafeWindow.clearInterval(Interval); } LOG("============= 开始刷课 ==========="); LOG("当前课时:" + ListStudy_view_now.innerText); if (document.querySelector('iframe')) { LOG("类型【文档】"); var document_ok = document.querySelector('.contain-bottom').querySelectorAll('button.el-button.el-button--default'); LOG("文档按钮" + document_ok); if (document_ok) { for (var i = 0; i < document_ok.length; i++) document_ok[i].click(); LOG("正在执行文档程序"); } LOG("============= 结束刷课 ==========="); NEXT_VIEW(); } else { LOG("类型【视频】"); var video = document.querySelector('video'); LOG("[寻找VIDEO]" + video); if (video) { video.autoplay = "autoplay"; video.muted = Video_muted; video.playbackRate = Video_speed; var p = document.querySelector('video'); if (p) p.click(); Interval = unsafeWindow.setInterval(VIDEO_OK, IntervalTime); } } } function VIDEO_OK() { try { var video = document.querySelector('video'); var bar = video.parentNode.children[2]; var processBar = bar.children[7]; var times = processBar.innerText.split('/'); var now = times[0].trim(); var end = times[1].trim(); LOG(times); if (now == end) { if (Interval) { unsafeWindow.clearInterval(Interval); } LOG("============= 结束刷课 ==========="); unsafeWindow.setTimeout(NEXT_VIEW, startTime); } } catch (err) { LOG("[ERROR] " + err); if (Interval) { unsafeWindow.clearInterval(Interval); } unsafeWindow.setTimeout(NEXT_VIEW, startTime); } } function NEXT_MAIN() { MN += 1; if (MN >= ListStudy_main.length) { LOG("全部完成"); alert("🎉 本课程学习完毕"); } else { ListStudy_main_now = ListStudy_main[MN]; ListStudy_main_now.click(); LOG("正在切换下一章节"); unsafeWindow.setTimeout(function () { GET_VIEW_LIST(); if (ListStudy_view == "") { LOG("当前小节已完成"); NEXT_MAIN(); } else { ListStudy_view_now.click(); unsafeWindow.setTimeout(function () { AUTO_COURSE() }, startTime); } }, startTime); } } function NEXT_VIEW() { LN += 1; if (LN >= ListStudy_view.length) { LOG("当前小节已完成"); NEXT_MAIN(); } else { ListStudy_view_now = ListStudy_view[LN]; ListStudy_view_now.click(); //LOG("当前课时:"+ListStudy_view_now.innerText); //LOG("下一课时:"+ListStudy_view_now.nextSibling.innerText); unsafeWindow.setTimeout(AUTO_COURSE, startTime); } } function GET_MAIN_LIST() { ListStudy_main = []; MN = 0; LOG("[学习章节]"); LOG("-------------"); //get main list var main_list = document.querySelector('.base-asider ul[role="menubar"]'); for (var a = 0; a < main_list.childElementCount; a++) { var sec_list = main_list.children[a].children[1]; for (var b = 0; b < sec_list.childElementCount; b++) { var _e = sec_list.children[b]; //if(_e.getAttribute('tabindex')=='0')//-1 unfinish 0 finish //{ // LOG("finished"); //}else{ LOG(_e.innerText); ListStudy_main.push(_e); //} } } //end ListStudy_main_now = ListStudy_main[0]; ListStudy_main_now.click(); LOG("-------------"); } function GET_VIEW_LIST() { ListStudy_view = []; LN = 0; LOG("[学习小节]"); LOG("-------------"); var list = document.querySelector('.plan-detailvideo div[role="tablist"]'); for (var i = 0; i < list.childElementCount; i++) { var e = list.children[i]; if (e.querySelector('i').classList.contains('complete'))//finished { LOG("finished"); } else { LOG(e.innerText); ListStudy_view.push(e); } } ListStudy_view_now = ListStudy_view[0]; LOG("-------------"); } function LOG(info) { console.log(info); $('#console').append('<div class="" style="marginLeft:10px;"><span id="">' + info + '</span></div>'); $('#console').scrollTop(10000000); } function CONSOLE() { unsafeWindow.onload = function () { return; var box = '<div class="CONSOLE" style="border: 2px dashed rgb(0, 85, 68);width: 330px; position: fixed; top: 0; right: 0; z-index: 99999;background-color: #e8e8e8; overflow-x: auto;"><button id="close_console">隐藏控制台</button><div class="console_box" id="console" style="height:360px;background:#fff;margin:10px auto 0;overflow:auto;"><div class="info"><div class="time"></div></div></div></div>'; $('body').append(box); document.getElementById("close_console").onclick = function () { var b = document.getElementById("console"); if (document.getElementById("close_console").innerText == '隐藏控制台') { b.style.display = "none"; document.getElementById("close_console").innerText = "显示控制台"; } else { b.style.display = ""; document.getElementById("close_console").innerText = "隐藏控制台"; } } } } })(); function show_homework_answer(str) { var ua = navigator.userAgent; var opacity = '0.95'; if (ua.indexOf("Edge") >= 0) { opacity = '0.6'; } else { opacity = '0.95'; } var copyTextBox = '<div id="copy-text-box" style="width:100%;height:100%;position: fixed;z-index: 9999;display: block;top: 0px;left: 0px;background:rgba(255,255,255,' + opacity + ');-webkit-backdrop-filter: blur(20px);display: flex;justify-content:center;align-items:center;">' + '<div id="copy-text-box-close" style="width:100%;height:100%;position:fixed;top:0px;left:0px;"></div>' + '<pre id="copy-text-content" style="width:60%;font-size:16px;line-height:22px;z-index:10000;white-space:pre-wrap;white-space:-moz-pre-wrap;white-space:-pre-wrap;white-space:-o-pre-wrap;word-wrap:break-word;word-break:break-all;max-height:70%;overflow:auto;"></pre>' + '</div>"'; $('#copy-text-box').remove(); $('body').append(copyTextBox); $('#copy-text-content').html(str); $('#copy-text-box-close').click(function () { $('#copy-text-box').remove(); }); } function get_spoc_homework_answer(id) { if (id) { var post_data = `callCount=1 scriptSessionId=\${scriptSessionId}190 c0-scriptName=MocQuizBean c0-methodName=getHomeworkPaperDto c0-id=0 c0-param0=number:PARAM_ID c0-param1=null:null c0-param2=boolean:false c0-param3=number:1 c0-param4=number:0 batchId=0` post_data = post_data.replace("PARAM_ID", id) console.log(post_data) //post start GM_xmlhttpRequest({ method: "POST", data: post_data, headers: { "Content-Type": "application/x-www-form-urlencoded" }, url: "https://www.icourse163.org/dwr/call/plaincall/MocQuizBean.getHomeworkPaperDto.dwr", onload: function (response) { //console.log(response.responseText) //console.log(s2) var answer_str = "" for (var i = 0; i < s2.length; i++) { var judgeDtos = s2[i].judgeDtos for (var j = 0; j < judgeDtos.length; j++) { console.log(judgeDtos[j].msg) answer_str += "<p>" + String(i + 1) + ":" + judgeDtos[j].msg + "</p>" } } show_homework_answer(answer_str) } }); //post end } } function get_answer(aid, id) { if (aid && id) { var post_data = "callCount=1\n" post_data += "scriptSessionId=${scriptSessionId}190\n" post_data += "httpSessionId=1d4ae12c733f41f495fc1fcbaeccd4f2\n" post_data += "c0-scriptName=MocQuizBean\n" post_data += "c0-methodName=getQuizPaperDto\n" post_data += "c0-id=0\n" post_data += "c0-param0=string:" + id + "\n" post_data += "c0-param1=number:" + aid + "\n" post_data += "c0-param2=boolean:true\n" post_data += "batchId=0" GM_xmlhttpRequest({ method: "POST", data: post_data, headers: { "Content-Type": "application/x-www-form-urlencoded" }, url: "https://www.icourse163.org/dwr/call/plaincall/MocQuizBean.getQuizPaperDto.dwr", onload: function (response) { var qlist = document.getElementsByClassName("j-list")[0].children[0].children //s1 is question list //var qnum=qlist.childElementCount for (var i = 0; i < s1.length; i++) { var answer = ""; var analyse = ""; if (s1[i].stdAnswer) { answer = s1[i].stdAnswer; } else { for (var j = 0; j < s1[i].optionDtos.length; j++) { var choice = s1[i].optionDtos[j] if (choice.answer) { answer += "ABCD"[j]//+":" //answer+=choice.content+"\n" } if (choice.analyse) { analyse += choice.analyse } } } if (s1[i].analyse) { analyse += s1[i].analyse } console.log(answer) console.log(analyse) answer = answer.replace("##%_YZPRLFH_%##", "或") var raw_html = `<div class="analysisInfo "> <div> <span class="f-f0 tt1">正确答案: </span> <span class="f-f0 tt2">ANSWER </span> </div> <div> <b>解析:ANALYSE </div> </div>` var $node = $(qlist[i]) raw_html = raw_html.replace("ANSWER", answer) raw_html = raw_html.replace("ANALYSE", analyse ? analyse : "无") $node.append(raw_html) } } }); } } function main() { var aid = 0; var id = 0; if (aid && id) { var topBox = "<div style='position:fixed;z-index:999999;background-color:#ccc;cursor:pointer;top:200px;left:0px;'>" + "<div id='pre_analysis' style='font-size:13px;padding:10px 2px;color:#FFF;background-color:#25AE84;'>提前解析</div>" + "</div>"; $("body").append(topBox); $("body").on("click", "#pre_analysis", function () { get_answer(aid, id); }); } else { var hash = document.location.hash; if (hash.indexOf("/learn/hw?id=") > 0) { //parse hash var homework_Box = "<div style='position:fixed;z-index:999999;background-color:#ccc;cursor:pointer;top:200px;left:0px;'>" + "<div id='get_homework_answer' style='font-size:13px;padding:10px 2px;color:#FFF;background-color:#25AE84;'>获取作业答案</div>" + "</div>"; $("body").append(homework_Box); $("body").on("click", "#get_homework_answer", function () { get_spoc_homework_answer(id) }); } } }; var wait_time = 6; function enableStartExam() { var btn_exam = $("#jrks"); showExam(true); var p = $("<p> </p>"); p.appendTo(btn_exam); setTimeout(() => { p.trigger('click'); }, wait_time); } function sleep(time, unit) { if (time == null) { time = wait_time * 1000; } if (unit != null) { time = time * 1000; } for (var t = Date.now(); Date.now() - t <= time;); } var fuc = setInterval(function () { //晚点再写 }, wait_time * 1000);